<template>
  <basic-container>
    <div id="deptTree"
         v-cloak>
      <el-tree :props="defaultProps"
               :data="treeData"
               :default-expanded-keys="default_expended_key"
               highlight-current
               node-key="id"
               :expand-on-click-node="false"
               ref="tree"
               accordion
               @node-click="handleNodeClick">
      </el-tree>
    </div>
  </basic-container>
</template>
<script>
var defaultNode = "";
export default {
  name: "deptTree",
  data() {
    return {
      default_expended_key: [],
      defaultProps: {
        children: "children",
        label: "name"
      },
      treeData: [
        {
          id: "1",
          leaf: false,
          name: "潍坊总部基地",
          children: [
            {
              id: 4,
              leaf: true,
              name: "北京云集汇通科技有限公司",
              children: []
            }
          ]
        },
        {
          id: "2",
          leaf: false,
          name: "北斗信息产业基地",
          children: [
            {
              id: 3,
              leaf: true,
              name: "蜂鸟智能科技有限公司"
            }
          ]
        }
      ]
    };
  },
  props: ["deptProperty"],
  methods: {
    // 初始化树
    loadChildrenNode(node, resolve) {
      return resolve(this.treeData);
    },
    handleNodeClick(data, node) {
      this.$emit("treeNode-click", data, node);
    }
  }
};
</script>

</html>
